<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
    <title>支付单管理   支付单明细（详情）   详情</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
        div.group-info {
            margin-top: 10px !important;
            margin-bottom: 0px !important;
        }
        input.innerInput {
            width: 98%;
        }
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>支付单明细详情</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">支付单管理</a></li>
            <li class="active"><a href="#">支付单查看</a></li>
        </ol>
     </section>
     
     <section class="content" style="min-height:inherit;">
          <form id="form" class="form-horizontal"  method="post">
            <input type="hidden" name=settlementId value="${settlement.settlementId}" />
            
            <div class="box box-success" style="margin-bottom: 0px;padding-bottom: 10px;">
               <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right">结算单号：</label>
                     <div class="col-sm-4 text-left" >${settlement.settlementCode}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right">结算单名称：</label>
                     <div id="orgName" class="col-sm-4 text-left">${settlement.settlementName}</div>
                </div>
                 
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right">总条目数：</label>
                     <div id="outstandAmt" class="col-sm-4 text-left">${settlement.totalOrders}</div>
                     <label for="inputTextAlter2" class="col-sm-2 text-right">总金额：</label>
                     <div id="availableAmt" class="col-sm-4 text-left">${settlement.totalAmount}</div>
                </div>
                
                <div class="form-group form-group-xs group-info">
                     <label for="inputTextAlter1" class="col-sm-2 text-right">备注：</label>
                     <div id="pendingAmt" class="col-sm-4 text-left">${settlement.remarks}</div>
                </div> 
                
            </div>
        </form>
     </section>
    
    
    <section class="content">
        <div class=" box box-primary">
            <div class="box-body">
                <div class=" form-inline">
        
                   <div class="form-group form-group-xs">
                        <label for="name">药品编码：</label>
                        <input class="form-control" type="text" id="drugCode" placeholder="药品编码" maxlength="100" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="name">通用名：</label>
                        <input class="form-control" type="text" id="drugName" placeholder="通用名" maxlength="100" />
                    </div>
                    <div class="form-group form-group-xs">
                        <label for="name">生产企业名称：</label>
                        <input class="form-control" type="text" id="prodCompName" placeholder="生产企业名称" maxlength="200" />
                    </div>
                    
                   <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm">查询</button>
                    
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
            <a href="${ctx}/payment/toSubmitPaymentDetailList.html?paymentBillId=${payment.paymentBillId}" class="btn btn-default btn-sm">返  回</a>
        </div>
   </section> 
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
   <script type="text/javascript">
         $(function() {
             
             jQuery("#gridlist").jqGrid({
            	 url: "${ctx}/payment/getPaymentPayDetailList.html",
                    mtype: "POST",
                    datatype: "json",
                    postData:{
                    	"paymentBillId":"${payment.paymentBillId}", 
                    	"settlementId":"${payment.settlementId}"
                    },
                    autowidth: true,
                    shrinkToFit: false,
                    height: 270,
                    colNames:[ '支付明细类型','配送企业ID','配送企业','医疗机构','药品编码', '通用名','剂型','规格','转换系数','单位','材质','生产企业','采购价','到货数量','支付状态','支付时间','支付流水号' ],
                    colModel:[
                        { name: 'bankAcctTransType', width:120,align:"center" ,sortable:false},   
                        { name: 'compId', width:160,hidden:true,align:"center" ,sortable:false},       
                        { name: 'compName', width:190,align:"left" ,sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showCompInfo(\''+ row.compId +'\');">'+cellvalue+'</a>';
                            }
                        },
                        { name: 'hospName', width:180,align:"left" ,sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showHospInfo(\''+ row.hospId +'\');">'+cellvalue+'</a>';
                            }
                        },      
                        { name: 'drugCode', width:100,align:"center" ,sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showDrugInfo(\''+ row.drugId +'\');">'+cellvalue+'</a>';
                            }
                        },
                        { name: 'drugName', width:140, align:"left",sortable:false},
                        { name: 'formName', width:80, align:"center",sortable:false},
                        { name: 'specName', width:80, align:"left",sortable:false},
                        { name: 'factor', width:80, align:"center",sortable:false},
                        { name: 'unit', width:40, align:"center",sortable:false},
                        { name: 'materialName', width:80, align:"center",sortable:false},
                        { name: 'prodCompName', width:180, align:"left",sortable:false,
                            formatter:function(cellvalue, options, row){
                                return '<a href="javascript:showCompInfo(\''+ row.prodCompId +'\');">'+cellvalue+'</a>';
                            }
                        },
                        { name: 'proPrice', width:80, align:"right",sortable:false,
                     	   formatter:function(cellvalue, options, row){
                               return formatAmount(cellvalue, options, row);
                           }},
                        { name: 'recpCount', width:60, align:"center",sortable:false},
                        { name: 'payStatus', width:100, align:"center",sortable:false,
							formatter:function(cellvalue, options, row){
								var str = "";
								if(cellvalue == 1){
									str = "支付单";
								}else{
									str = "退货单";
								}
								return str;
							}	
						},
                        { name: 'payTime', width:140, align:"center",sortable:false},
                        { name: 'paySerialNumber', width:160, align:"center",sortable:false}
                        
                    ],
                     rowNum: 20,
                     rowList: [10, 20, 50, 100],
                     rownumbers: true,
                     pager: "#gridpage",
                     viewrecords: true,
                     multiselect: false, 
                     caption: "支付单明细详情列表",
                     jsonReader: {
                         repeatitems: false,
                         id: "ids"
                     }
                });
                
                $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
                
                $(window).trigger("resize");
                
            });
               
           //查询
           function gridSerch() {
               var drugCode = $.trim($("#drugCode").val());
               var drugName = $.trim($("#drugName").val());
               var prodCompName = $.trim($("#prodCompName").val());
               $("#gridlist").jqGrid('setGridParam',{  
                   datatype:'json',
                   postData:{
                       "drugCode":drugCode,
                       "drugName":drugName,
                       "prodCompName":prodCompName
                   },
                   page:1
               }).trigger("reloadGrid"); //重新载入  
           }
           
           
           //医疗机构信息弹窗
           function showHospInfo(hospId) {
               $.HN.dialog.open({
                   "id": "showHospInfo", 
                   "title": "医疗机构信息", 
                   "url": "${ctx}/stdHospInfo/hospInfoDetail.html?hospId="+hospId,
                   "data": {}, 
                   "width": 800, 
                   "height": 400, 
                   "closefunc":function() {
                       
                   }
               });
           }
           
           //药品信息弹窗
           function showDrugInfo(drugId) {
               $.HN.dialog.open({
                   "id": "showDrugInfo", 
                   "title": "药品信息", 
                   "url": "${ctx}/stdDrug/drugInfoDetail.html?drugId="+drugId,
                   "data": {}, 
                   "width": 800, 
                   "height": 400, 
                   "closefunc":function() {
                       
                   }
               });
           }
           
           //生产企业信息弹窗
           function showCompInfo(prodCompId) {
               $.HN.dialog.open({
                   "id": "showCompInfo", 
                   "title": "生产企业信息", 
                   "url": "${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+prodCompId,
                   "data": {}, 
                   "width": 800, 
                   "height": 400, 
                   "closefunc":function() {
                       
                   }
               });
           }
           
    </script>
</body>
</html>